import java.io.IOException;

import com.pi4j.component.servo.ServoDriver;
import com.pi4j.component.servo.ServoProvider;
import com.pi4j.component.servo.impl.RPIServoBlasterProvider;
import com.pi4j.io.gpio.GpioPin;
import com.pi4j.io.gpio.RaspiPin;
import com.pi4j.util.Console;
import com.pi4j.wiringpi.Gpio;
import com.pi4j.wiringpi.SoftPwm;


public class pwm2 {

	public static void main(String[] args) throws InterruptedException,
			IOException {
		Gpio.wiringPiSetup();
		Console console = new Console();
		console.promptForExit();
		// Set the PinNumber pin to be a PWM pin, with values changing from 0 to
		// 1000
		// this will give enough resolution to the servo motor
		SoftPwm.softPwmCreate(24, 0, 100);
		SoftPwm.softPwmCreate(25, 0, 100);
		
		int value24 = 50;
		int value25 = 50;
		SoftPwm.softPwmWrite(24, value24);
		SoftPwm.softPwmWrite(25, value25);
		int i = 0;
		while (!console.exiting()) {
			System.out.println(i);
			value24+=10;
			value25-=10;
			SoftPwm.softPwmWrite(24, value24);
			SoftPwm.softPwmWrite(25, value25);	
			System.out.println("value24"+value24);
			System.out.println("value25"+value25);
			Thread.sleep(1000);
			if (value24 == 100) {
				break;
			}
		}
		System.out.println("++++++++++++++++++++++");
		while (!console.exiting()) {
			
			value24-=10;
			value25+=10;
			SoftPwm.softPwmWrite(24, value24);
			SoftPwm.softPwmWrite(25, value25);	
			System.out.println("value24"+value24);
			System.out.println("value25"+value25);
			Thread.sleep(1000);
			if (value24 == 0) {
				break;
			}
		}
		SoftPwm.softPwmWrite(24, 0);
		SoftPwm.softPwmWrite(25, 0);
	}
}
